package demo1;

import java.util.List;

/**
 * @Author liangzai
 * @Description:
 */
public class Test {
    public List<String> generateParenthesis(int n) {

    }

    private void generateParenthesisChild(){

    }


    public static void main1(String[] args) {
        int[] array = {1,0,0,0,1,1,0,1};
        minOperations(array);
    }

    public static int minOperations(int[] nums) {
        int n = nums.length;
        int ans = 0;
        for (int i = 0; i < n; i++) {
            if (nums[i] == 0) {
                if (i > n - 3) {
                    return -1;
                }
                nums[i] ^= 1;
                nums[i + 1] ^= 1;
                nums[i + 2] ^= 1;
                ans++;
            }
        }
        return ans;
    }
}
